<?php  declare(strict_types=1);
/**
 * Created by IntelliJ IDEA.
 * User: 张伯发
 * Date: 2019/8/1
 * Time: 15:52
 */

namespace App\Http\Controller\Member;


use App\Common\Util\RequestUtil;
use App\Model\Dao\MemberDao;
use PhpOption\Option;
use Swoft\Bean\Annotation\Mapping\Inject;
use Swoft\Http\Message\Request;
use Swoft\Http\Server\Annotation\Mapping\Controller;
use Swoft\Http\Server\Annotation\Mapping\RequestMapping;

/**
 *
 * Class MemberController
 * @Controller("member")
 * @author 张伯发 2019/8/1 15:52
 */
class MemberController
{


    /**
     * @Inject()
     * @var MemberDao
     */
    private $MemberDao;


    /**
     * @RequestMapping(route="login")
     * @param Request $request
     * @return array
     * @throws \ReflectionException
     * @throws \Swoft\Bean\Exception\ContainerException
     * @author 张伯发 2019/8/1 15:54
     */
    public function login(Request $request)
    {
        $params = RequestUtil::HttpBodyMessage($request);

        return ['result' => $params];
    }


    /**
     * @RequestMapping("register")
     * @param Request $request
     * @throws \ReflectionException
     * @throws \Swoft\Bean\Exception\ContainerException
     * @author 张伯发 2019/8/2 14:20
     */
    public function register(Request $request)
    {
        $params = RequestUtil::HttpBodyMessage($request);

        var_dump($params['age']);



        $this->MemberDao->register($params);
    }
}
